package com.heima.admin.controller;

import com.heima.admin.dto.LoginDto;
import com.heima.admin.service.IAdUserService;
import com.heima.common.dto.ResponseResult;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@Slf4j
@RestController
@RequestMapping("/login")
@Api(tags = "平台管理API") // Swagger,knife4j
public class LoginController {

    @Autowired
    private IAdUserService userService;

    /**
     * 管理员登录
     * @param dto
     * @return
     */
    @PostMapping("/in")
    @ApiOperation(value = "管理员登录", notes = "author:liJie")  // value指名称  notes 备注
    @ApiImplicitParam(name = "dto", value = "管理员信息", required = true, dataType = "LoginDto")
    public ResponseResult login(@RequestBody LoginDto dto) {
        log.info("[平台管理微服务======>管理员登录，接收参数：{}]",dto.toString());
        return userService.login(dto);
    }
}